package com.slink.fxfk.common.service.imp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.slink.fxfk.common.dao.CommonDao;
import com.slink.fxfk.common.domain.po.PUser;
import com.slink.fxfk.common.service.UserService;
import com.slink.fxfk.framework.util.CodingGenerator;

@Service
public class UserServiceImpl implements UserService
{
    @Autowired
    private CommonDao commonDao;

    public UserServiceImpl()
    {
        System.out.println("init...");
    }

	@Override
	public void createUser() {
		PUser u = new PUser();
        u.setId(CodingGenerator.uuid());
        u.setUsername("抠鼻");
        this.commonDao.save(u);
		
	}

	@Override
	public PUser getUser(String id) {
		return this.commonDao.get(PUser.class, id);
	}

	@Override
	public void updateUser(String id) {
		PUser user = this.commonDao.get(PUser.class, id);
		this.commonDao.saveOrUpdate(user);
		
	}
    
    
}
